package com.ruoyi.system.service.work.impl;

import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.system.domain.work.WorkCustomer;
import com.ruoyi.system.mapper.work.WorkCustomerMapper;
import com.ruoyi.system.service.work.IWorkCustomerService;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

import java.util.List;


/**
 * 客户信息Service业务层处理
 *
 * @author ruoyi
 * @date 2024-01-23
 */
@Service
public class WorkCustomerServiceImpl implements IWorkCustomerService {
    @Resource
    private WorkCustomerMapper workCustomerMapper;

    /**
     * 查询客户信息
     *
     * @param wUserId 客户信息主键
     * @return 客户信息
     */
    @Override
    public WorkCustomer selectWorkCustomerByWUserId(String wUserId) {
        return workCustomerMapper.selectWorkCustomerByWUserId(wUserId);
    }

    /**
     * 查询客户信息列表
     *
     * @param workCustomer 客户信息
     * @return 客户信息
     */
    @Override
    public List<WorkCustomer> selectWorkCustomerList(WorkCustomer workCustomer) {
        return workCustomerMapper.selectWorkCustomerList(workCustomer);
    }

    /**
     * 新增客户信息
     *
     * @param workCustomer 客户信息
     * @return 结果
     */
    @Override
    public int insertWorkCustomer(WorkCustomer workCustomer) {
        workCustomer.setCreateTime(DateUtils.getNowDate());
        return workCustomerMapper.insertWorkCustomer(workCustomer);
    }

    /**
     * 修改客户信息
     *
     * @param workCustomer 客户信息
     * @return 结果
     */
    @Override
    public int updateWorkCustomer(WorkCustomer workCustomer) {
        workCustomer.setUpdateTime(DateUtils.getNowDate());
        return workCustomerMapper.updateWorkCustomer(workCustomer);
    }

    /**
     * 批量删除客户信息
     *
     * @param wUserIds 需要删除的客户信息主键
     * @return 结果
     */
    @Override
    public int deleteWorkCustomerByWUserIds(String[] wUserIds) {
        return workCustomerMapper.deleteWorkCustomerByWUserIds(wUserIds);
    }

    /**
     * 删除客户信息信息
     *
     * @param wUserId 客户信息主键
     * @return 结果
     */
    @Override
    public int deleteWorkCustomerByWUserId(String wUserId) {
        return workCustomerMapper.deleteWorkCustomerByWUserId(wUserId);
    }
}
